<?php
/**
 * Created by PhpStorm.
 * User: zjw
 * Date: 2018/5/2
 * Time: 上午11:44
 */

namespace common\service;

class ServiceFactory
{
    private static $_instance;
    private static $serviceSet;

    public static function getInstance()
    {
        if (!isset(self::$_instance)) {
            self::$_instance = new self();
        }
        return self::$_instance;
    }

    /**
     * @return ProductService
     */
    public function getProductService()
    {
        if (!isset(self::$serviceSet['productService'])) {
            self::$serviceSet['productService'] = new ProductService();
        }
        return self::$serviceSet['productService'];
    }

    /**
     * @return BrandService
     */
    public function getBrandService()
    {
        if (!isset(self::$serviceSet['brandService'])) {
            self::$serviceSet['brandService'] = new BrandService();
        }
        return self::$serviceSet['brandService'];
    }

    /**
     * @return ActivityService
     */
    public function getActivityService()
    {
        if (!isset(self::$serviceSet['activityService'])) {
            self::$serviceSet['activityService'] = new ActivityService();
        }
        return self::$serviceSet['activityService'];
    }

    /**
     * @return ActivityCategoryService
     */
    public function getActivityCategoryService()
    {
        if (!isset(self::$serviceSet['activityCategoryService'])) {
            self::$serviceSet['activityCategoryService'] = new ActivityCategoryService();
        }
        return self::$serviceSet['activityCategoryService'];
    }

    /**
     * @return CouponService
     */
    public function getCouponService()
    {
        if (!isset(self::$serviceSet['couponService'])) {
            self::$serviceSet['couponService'] = new CouponService();
        }
        return self::$serviceSet['couponService'];
    }

    /**
     * @return CouponCategoryService
     */
    public function getCouponCategoryService()
    {
        if (!isset(self::$serviceSet['couponCategoryService'])) {
            self::$serviceSet['couponCategoryService'] = new CouponCategoryService();
        }
        return self::$serviceSet['couponCategoryService'];
    }

    /**
     * @return UserService
     */
    public function getUserService()
    {
        if (!isset(self::$serviceSet['userService'])) {
            self::$serviceSet['userService'] = new UserService();
        }
        return self::$serviceSet['userService'];
    }

    /**
     * @return VoteService
     */
    public function getVoteService()
    {
        if (!isset(self::$serviceSet['voteService'])) {
            self::$serviceSet['voteService'] = new VoteService();
        }
        return self::$serviceSet['voteService'];
    }

    /**
     * @return BoxService
     */
    public function getBoxService()
    {
        if (!isset(self::$serviceSet['boxService'])) {
            self::$serviceSet['boxService'] = new BoxService();
        }
        return self::$serviceSet['boxService'];
    }

    /**
     * @return UserShareService
     */
    public function getUserShareService()
    {
        if (!isset(self::$serviceSet['userShareService'])) {
            self::$serviceSet['userShareService'] = new UserShareService();
        }
        return self::$serviceSet['userShareService'];
    }

    /**
     * @return ConcernService
     */
    public function getConcernService()
    {
        if (!isset(self::$serviceSet['concernService'])) {
            self::$serviceSet['concernService'] = new ConcernService();
        }
        return self::$serviceSet['concernService'];
    }

    /**
     * @return GroupbuyService
     */
    public function getGroupbuyService()
    {
        if (!isset(self::$serviceSet['GroupbuyService'])) {
            self::$serviceSet['GroupbuyService'] = new GroupbuyService();
        }
        return self::$serviceSet['GroupbuyService'];
    }
}
